<template>
    <div>
      <HomeHeader :city="city"></HomeHeader>
      <HomeSwiper :swiperList="swiperList"></HomeSwiper>
      <HomeIcons :iconList="iconList"></HomeIcons>
      <HomeRecommend :recommendList="recommendList"></HomeRecommend>
      <HomeWeekend :weekendList="weekendList"></HomeWeekend>
    </div>
  </template>
  
  <script>
  import HomeRecommend from './home/Recommend.vue'
  import HomeSwiper from './home/Swiper.vue'
  import HomeHeader from './home/Header.vue'
  import HomeIcons from './home/Icons.vue'
  import HomeWeekend from './home/Weekend.vue'
  import axios from 'axios'
  export default {
    name: 'MyHome',
    data(){
      return{
      city:'',
      swiperList:[],
      iconList:[],
      recommendList:[],
      weekendList:[]
      }
    },
    methods:{
      getHomeInfo(){
        axios.get('/mock/index.json').then(this.getHomeInfoSucc)
      },
      getHomeInfoSucc(res){
        console.log(res)
        res = res.data;
        if(res.ret && res.data){
          const data = res.data;
          this.city = data.city;
          this.swiperList = data.swiperList;
          this.iconList = data.iconList;
          this.recommendList = data.recommendList;
          this.weekendList = data.weekendList;
        }
      }
    },
    mounted(){
      this.getHomeInfo()
    },
    components: {
      HomeHeader,HomeIcons,HomeSwiper,HomeRecommend,HomeWeekend
    }
  }
  </script>
  
  <style>
  
  </style>
  